/*
 * Copyright (C) 2010-2011 Enrique Lara (enrique.posix2.lara@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
 * limitations under the License.
  */
package trs.wmata;

import app.timetogo.model.Agency;
import app.timetogo.model.Route;
import app.timetogo.model.Vehicle;

import java.io.Serializable;

public class Train implements Serializable, Vehicle {
    private static final long serialVersionUID = -428569634185696341L;

//    private int cars = -1;
    private String destination = "";
    private String destinationCode = "";
    private String destinationName = "";
    private int group = -1;
    private String line = "";

//    private String locationCode = "";
//    private String locationName = "";
    private int minutes = -1;
    private String status = "";
    private final Agency agency;

    public Train(final Agency agency) {
        this.agency = agency;
    }

    /**
     * Number of cars in a particular train (usually 6 or 8).
     */

//    public int getCars() {
//        return this.cars;
//    }

    /**
    * The short name of the destination station.
    */
    public String getDestination() {
        return this.destination;
    }

    /**
     * The ID of destination station.
     */
    public String getDestinationCode() {
        return this.destinationCode;
    }

    /**
     * The name of destination station.
     */
    public String getDestinationName() {
        return this.destinationName;
    }

    /**
     * Track number.
     */
    public int getGroup() {
        return this.group;
    }

    /**
     * ID of the metro line. Can be RD, BL, YL, OR, GR.
     */
    public String getLine() {
        return this.line;
    }

    /**
     * ID of the station where the train is arriving.
     */

//    public String getLocationCode() {
//        return this.locationCode;
//    }

    /**
     * The name of the station where the train is arriving.
     */

//    public String getLocationName() {
//        return this.locationName;
//    }

    /**
     * The minutes to train arrival.
     */
    public int getMinutes() {
        return this.minutes;
    }

    /**
     * Can be "BRD", "ARR", or null.
     */
    public String getStatus() {
        return this.status;
    }

//    public void setCars(final int cars) {
//        this.cars = cars;
//    }
    public void setDestination(final String destination) {
        this.destination = destination;
    }

    public void setDestinationCode(final String destinationCode) {
        this.destinationCode = destinationCode;
    }

    public void setDestinationName(final String destinationName) {
        this.destinationName = destinationName;
    }

    public void setGroup(final int group) {
        this.group = group;
    }

    public void setLine(final String line) {
        this.line = line;
    }

//    public void setLocationCode(final String locationCode) {
//        this.locationCode = locationCode;
//    }

//    public void setLocationName(final String locationName) {
//        this.locationName = locationName;
//    }
    public void setMinutes(final int minutes) {
        this.minutes = minutes;
    }

    public void setStatus(final String status) {
        this.status = status;
    }

    public Route getRoute() {
        return agency.getRouteByCode(getLine());
    }
}
